import { appendFile, writeFile, copyFile } from 'fs';
const data1 = 'x1y1';
const data2 = Buffer.from('m1n1');


//追加式写入
appendFile('./files/app031.txt', data1, (err) => {
    if (err) {
        throw err;
    }else {
        console.log('appendFile success');
    }
});


//覆盖式写入-1
writeFile('./files/app032.txt', data1, (err) => {
    if (err) {
        throw err;
    }else {
        console.log('writeFile success 1');
    }
});
//覆盖式写入-2
writeFile('./files/app033.txt', data2, (err) => {
    if(err) {
    }else {
        console.log('writeFile success 2');
    }
});

//覆盖式复制
copyFile('./files/app021.txt', './files/app034.txt', (err) => {
    if (err) {
    }else {
        console.log('copyFile success');
    }
});